<%@ LANGUAGE="VBSCRIPT" %> <% option explicit %> <%response.buffer=false %> Clients Remark - Optic-Switch.com <%'提交保存 dim sName2 sName2=request.form("txtName") if Trim(sName2)<>"" then function htmlencode2(str) dim result dim l if isNULL(str) then htmlencode2="" exit function end if l=len(str) result="" dim i for i = 1 to l select case mid(str,i,1) case "<" result=result+"<" case ">" result=result+">" case chr(13) result=result+"
" case chr(34) result=result+""" case "&" result=result+"&" case chr(32) 'result=result+" " if i+1<=l and i-1>0 then if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9) then result=result+" " else result=result+" " end if else result=result+" " end if case chr(9) result=result+" " case else result=result+mid(str,i,1) end select next htmlencode2=result end function dim WINNT_CHINESE function strLength(str) if WINNT_CHINESE then dim l,t,c dim i l=len(str) t=l for i=1 to l c=asc(mid(str,i,1)) if c<0 then c=c+65536 if c>255 then t=t+1 end if next strLength=t else strLength=len(str) end if end function sub chkInput() if Trim(sName)="" then sName="Anonymity" elseif strLength(sName)>=100 then foundError=true Msg=Msg+"
  • client no large 100 !
  • " end if if strLength(sEmail)>255 then foundError=true Msg=Msg+"
  • email skype or MSN no large 255 !
  • " end if if Trim(sInput)="" then foundError=true Msg=Msg+"" elseif strLength(sInput)>16384 then foundError=true Msg=Msg+"
  • content too large !
  • " end if end sub sub getInput() sName=request.form("txtName") sEmail=request.form("txtEmail") sInput=request.form("txtContent") end sub %> <% dim sql dim rs dim sName dim sEmail dim sInput dim foundError dim Msg getInput() chkInput() if foundError then call showErrors() else 'saveData() if foundError then call showErrors() else call success() end if end if set rs=nothing 'conn.close 'set conn=nothing sub saveData() on error resume next dim cmdTemp dim InsertCursor Set cmdTemp = Server.CreateObject("ADODB.Command") Set InsertCursor = Server.CreateObject("ADODB.Recordset") cmdTemp.CommandText = "SELECT * FROM book where name is null" cmdTemp.CommandType = 1 Set cmdTemp.ActiveConnection = conn InsertCursor.Open cmdTemp, , 1, 3 InsertCursor.addnew InsertCursor("name") =htmlencode2(sName) InsertCursor("email") =htmlencode2(sEmail) InsertCursor("content") =htmlencode2(sInput) InsertCursor("time") =cstr(now()) InsertCursor.Update InsertCursor.close 'conn.close set InsertCursor=nothing 'set conn=nothing if err>0 then err.clear foundError=true Msg="
  • DB connect error !
  • " end if end sub %> <%sub success() '提示发送成功,发邮件通知 dim frommail,tomail,mailsubject,mailbody frommail="sales@optic-switch.com.com" tomail="henyi99@163.com" mailsubject="www.optic-switch.com clients remark notify" mailbody=sName+" : "+sInput Msg="Saving your Remark successfully,Thanks!" Call Jmail(frommail,tomail,mailsubject,mailbody) 'response.refresh %> <%end sub end if '提交保存end%>
     

    Clients Remark:


    <%'列表显示 const MaxPerPage=9 '分页显示的纪录个擿 dim sqlD dim rsd dim totalPut dim CurrentPage dim TotalPages dim i,j if not isempty(request("page")) then currentPage=cint(request("page")) else currentPage=1 end if set rsd=server.createobject("adodb.recordset") %> <% sqlD="select * from book"' order by id desc rsd.open sqlD,conn,1,1 if rsd.eof and rsd.bof then response.write "

    No any client Remark!

    " else totalPut=rsd.recordcount totalPut=rsd.recordcount if currentpage<1 then currentpage=1 end if if (currentpage-1)*MaxPerPage>totalput then if (totalPut mod MaxPerPage)=0 then currentpage= totalPut \ MaxPerPage else currentpage= totalPut \ MaxPerPage + 1 end if end if if currentPage=1 then showContent 'showpages else if (currentPage-1)*MaxPerPage
    <% do while not (rsd.eof or err) %> <% i=i+1 if i>=MaxPerPage then exit do rsd.movenext loop %>
    <%=rsd("content")%>
    <%=rsd("name")%> 
    <%=rsd("time")%> 
    <%showpages%>
    <% end sub sub showpages() dim n if (totalPut mod MaxPerPage)=0 then n= totalPut \ MaxPerPage else n= totalPut \ MaxPerPage + 1 end if if n="" then response.write "

    >> Page " response.write "1" response.write "

    " exit sub end if dim k response.write "

    >> Page " for k=1 to n if k=currentPage then response.write "["+Cstr(k)+"] " else response.write "["+""+Cstr(k)+"] " end if next response.write "

    " end sub ''列表显示end %>

     

     

       
     

    Clients name:

    E-Mail Skype Msn:

    Remark:


    <%=dbmsg%> <%=Msg%>


      Home
     
      Manufacturer of Fiber Optic Equipment
    optic-switch.com Factory Science And Tech Co., Ltd,. Copyright© 2009